package qlsl.androiddesign.adapter.subadapter;

import java.util.List;

import com.qlsl.androiddesign.kuaiwa.R;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import qlsl.androiddesign.activity.baseactivity.BaseActivity;
import qlsl.androiddesign.adapter.baseadapter.BaseAdapter;
import qlsl.androiddesign.entity.otherentity.PostingReply;
import qlsl.androiddesign.util.commonutil.ImageUtils;
import qlsl.androiddesign.util.commonutil.TimeFormatUtils;

/**
 * 回复我的<br/>
 */
public class PostingReplyAdapter extends BaseAdapter<PostingReply> {

	public PostingReplyAdapter(BaseActivity activity, List<PostingReply> list) {
		super(activity, list);
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		convertView = getItemView(convertView, R.layout.listitem_posting_reply);

		ImageView iv_icon = getView(convertView, R.id.iv_icon);
		TextView tv_text = getView(convertView, R.id.tv_name);
		TextView tv_time = getView(convertView, R.id.tv_time);
		TextView tv_sec_title = getView(convertView, R.id.tv_sec_title);
		TextView tv_sec_content = getView(convertView, R.id.tv_sec_content);
		TextView tv_section = getView(convertView, R.id.tv_section);

		PostingReply item = getItem(position);
		String name = item.getUsername();
		String time = item.getTime();
		String title = "回复我：" + item.getCommentcontent();
		String content = "原帖：" + item.getTitle();

		ImageUtils.circle(activity, item.getPhoto(), iv_icon);
		tv_text.setText(name);
		tv_time.setText(TimeFormatUtils.format(time));
		tv_sec_title.setText(title);
		tv_sec_content.setText(content);
		tv_section.setText("[" + item.getFirstsection() + ">" + item.getSecondsection() + "]");

		return convertView;
	}
}
